package com.learn.springcloud.dubbo.job;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

/**
 * @Author: 胡伟
 * @Date: 2020/11/26 14:41
 * @Description:
 */
@Component
@Slf4j
public class TestJob {
    @XxlJob("testJob")
    public ReturnT<String> testJob(String param)  {
        XxlJobLogger.log("日志来咯，我准备开始执行");
        for (int i = 0; i < 100; i++) {
            System.out.println("执行第" + i + "次");
        }
        log.info("正在测试xxl-job定时任务");
        return ReturnT.SUCCESS;
    }
}
